from sqlalchemy.orm import Session
from sqlalchemy import and_

from apis_module.model.users_model import Users


def login_by_account(db: Session, user_name: str):
    """
    根据用户名查询要登录系统的用户
    :param db:
    :param user_name:
    :return:
    """
    user = db.query(Users) \
        .filter(Users.user_name == user_name) \
        .distinct() \
        .first()

    return user
